<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Amaze UI Admin user Examples</title>
  <meta name="description" content="这是一个 user 页面">
  <meta name="keywords" content="user">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="/Public/assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="/Public/assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="/Public/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="/Public/assets/css/admin.css">
  <!-- 引用控制层插件样式 -->
  <link rel="stylesheet" href="/Public/tools/php_img_upload/control/css/zyUpload.css" type="text/css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<include file="./Application/Admin/View/Share/header.html" />

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <include file="./Application/Admin/View/Share/left.html" />
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">商品管理</strong></div>
      </div>

      <hr/>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
          

        </div>

        <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4">
			<form class="am-form am-form-horizontal" action="/Admin/ware/itoinsert?id={$id}" method="post" name="ware_form">
				
				<div class="am-form-group">
				  <label for="ware-name" class="am-u-sm-3 am-form-label">品牌</label>
				  <div class="am-u-sm-9">
					<input type="text" id="ware-brand" name="brand" placeholder="" value="{$res.brand}">
				  </div>
				</div>
				
				<div class="am-form-group">
				  <label for="ware-name" class="am-u-sm-3 am-form-label">商品名称</label>
				  <div class="am-u-sm-9">
					<input type="text" id="ware-name" name="name" placeholder="" value="{$res.name}">
				  </div>
				</div>
				
				<div class="am-form-group">
				  <label for="ware-name" class="am-u-sm-3 am-form-label">系统</label>
				  <div class="am-u-sm-9">
					<input type="text" id="ware-system" name="system" placeholder="" value="{$res.system}">
				  </div>
				</div>
				
				<div class="am-form-group">
				  <label for="ware-name" class="am-u-sm-3 am-form-label">商品毛重</label>
				  <div class="am-u-sm-9">
					<input type="text" id="ware-height" name="height" placeholder="" value="{$res.height}">
				  </div>
				</div>
				
				<div class="am-form-group">
				  <label for="ware-name" class="am-u-sm-3 am-form-label">商品产地</label>
				  <div class="am-u-sm-9">
					<input type="text" id="ware-produce" name="produce" placeholder="" value="{$res.produce}">
				  </div>
				</div>
				
				<div class="am-form-group">
				  <label for="ware-name" class="am-u-sm-3 am-form-label">商品价格</label>
				  <div class="am-u-sm-9">
					<input type="text" id="ware-price" name="price" placeholder="" value="{$res.price}">
				  </div>
				</div>
				
				<div class="am-form-group">
				  <label for="user-phone" class="am-u-sm-3 am-form-label">缩略图</label>
				  <div class="am-u-sm-9">
					<img src="{$ret.img_src}" width="100px" height="100px" /> 
					<br>
					<button type="button" id="up_img" class="am-btn am-btn-primary am-topbar-btn am-btn-sm" data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 753, height: 225}" >图片上传</button>
				  </div>
				</div>
				
			    <div class="am-form-group">
				  <label for="user-intro" class="am-u-sm-3 am-form-label">商品详情</label>
				  <div class="am-u-sm-9">
					<!-- 加载编辑器的容器 -->
					<script id="container" name="content"  type="text/plain">
						{$res.content|htmlspecialchars_decode}
					</script>
					<!-- 配置文件 -->
					<script type="text/javascript" src="/Public/tools/UEditor/ueditor.config.js"></script>
					<!-- 编辑器源码文件 -->
					<script type="text/javascript" src="/Public/tools/UEditor/ueditor.all.js"></script>
					<!-- 实例化编辑器 -->
				  </div>
				</div>
				
				<div class="am-form-group">
				  <div class="am-u-sm-9 am-u-sm-push-3">
					<button type="button" onclick="do_submit();" class="am-btn am-btn-primary">保存修改</button>
				  </div>
				</div>
            </form>
        </div>
      </div>
    </div>

    

  </div>
  <!-- content end -->

</div>

<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1">
	<div class="am-modal-dialog" style="width:750px;">
		<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
		<div id="demo" class="demo">
		</div>   
		<div id="successinfo">
		<div class="am-modal-bd">
		</div>
	</div>
</div>	


<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>

<include file="./Application/Admin/View/Share/footer.html" />

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/Public/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="/Public/assets/js/amazeui.min.js"></script>

<script src="/Public/assets/js/app.js"></script>
<!-- 引用核心层插件 -->
<script type="text/javascript" src="/Public/tools/php_img_upload/core/zyFile.js"></script>
<!-- 引用控制层插件 -->
<script type="text/javascript" src="/Public/tools/php_img_upload/control/js/zyUpload.js"></script>



<!--点击改变按钮成提交-->
<script>
function do_submit(){
	document.ware_form.submit();
}
var ue = UE.getEditor('container');

var ware_id = '{$id}';

$(function(){
	// 初始化插件
	var width = $(window).width();
	if ( width >= 650 )	 width = '750px';
	else 	width = "100%";

	$("#demo").zyUpload({
		width            :   width,                 // 宽度
		height           :   "auto",                 // 宽度
		itemWidth        :   "140px",                 // 文件项的宽度
		itemHeight       :   "100px",                 // 文件项的高度
		//url              :   "/upload/UploadAction",  // 上传文件的路径
		url              :   "/Admin/Ware/imgUpload?id="+ware_id,
		inputName		 : 	'_img',
		id 				 :	 1,
		multiple         :   true,                    // 是否可以多个文件上传
		dragDrop         :   false,                    // 是否可以拖动上传文件
		del              :   true,                    // 是否可以删除文件
		finishDel        :   false,  				  // 是否在上传文件完成后删除预览
		/* 外部获得的回调接口 */
		onSelect: function(selectFiles, allFiles){    // 选择文件的回调方法  selectFile:当前选中的文件  allFiles:还没上传的全部文件
			console.info("当前选择了以下文件：");
			console.info(selectFiles);
		},
		onProgress: function(file, loaded, total){    // 正在上传的进度的回调方法
			var eleProgress = $("#uploadProgress_" + file.index), percent = (loaded / total * 100).toFixed(2) + '%';
			eleProgress.html(percent);
			console.info(file.index);
			console.info("当前正在上传此文件：");
			console.info(file.name);
			console.info("进度等信息如下：");
			console.info(loaded);
			console.info(total);
		},   
		onDelete: function(file, files){              // 删除一个文件的回调方法 file:当前删除的文件  files:删除之后的文件
			console.info("当前删除了此文件：");
			console.info(file.name);
		},
		onSuccess: function(file, response){          // 文件上传成功的回调方法
			console.info("此文件上传成功：");
			$('#successinfo').append("<p>"+response+"</p>");
			console.info(response);
			$('.am-u-sm-9').find('img').attr('src',response);
			$('#doc-modal-1').modal('close');
			
			
		},
		onFailure: function(file, response){          // 文件上传失败的回调方法
			$("#uploadImage_" + file.index).css("opacity", 0.2);
			console.info("此文件上传失败：");
			console.info(file.name);
		},
		onComplete: function(response){           	  // 上传完成的回调方法
			console.info("文件上传完成");
			console.info(response);
			
		}
	});
	
});	
	
	
</script>
</body>
</html>
